//断言
// 类型断言好比其它语言里的类型转换（类型检测），但是不进行特殊的数据检查和解构。
//断言有两种形式
//泛型 标识 <>  要和断言区分开来
// 1.尖括号”语法：
// let someValue: any = "this is a string";
// let strLength: number = (<string>someValue).length;
// console.log(strLength);
// 2.as 语法
// let someValue: any = "this is a string";
// let strLength: number = (someValue as string).length;
//检测是否是数值类型
var Num = 12;
var str = "胡子瑜";
console.log(str);
var nwenuber = 12;
if (nwenuber == 12) {
    console.log("是数字");
}
//枚举
// enum Color {Rad,Green,Blue}
// console.log(Color);
// let c:Color=Color.Green;
// console.log(c,'c'); //打印出来的下标
var Color;
(function (Color) {
    Color[Color["Red"] = 1] = "Red";
    Color[Color["Green"] = 2] = "Green";
    Color[Color["Blue"] = 4] = "Blue";
})(Color || (Color = {}));
console.log(Color);
console.log(Color[2]);
// enum Color {Red="1",Green="2",Blue="4"}
// console.log(Color);
var obj = {
    a: 111,
    b: 222,
    c: 333
};
for (var i in obj) {
    console.log(obj, 'obj');
    console.log(i, 'i');
    console.log(obj[i]);
}
//联合类型  |
var a = false;
var obj2 = {
    a: 1,
    b: '1',
    c: false
};
console.log(obj2);
// ? 可选  让类型不为必须校验
var obj3 = {
    a: 1
};
//这里只能匹配同一种数据类型
var thisArr = [false, true, false, true];
var thisass = [{}, { a: 1, b: 2 }];
console.log(thisass);
var isDone = false;
var decLiteral = 6;
var user = '胡子瑜';
user = '123456';
var user1 = "\u80E1\u5B50\u745C";
var age = 18;
var sentence = "hello,my name is ".concat(user1, " I'll be").concat(age + 1, " years old next month");
var list = [1, 2, 3];
var list2 = [1, 2, 3];
// let x: [string, number];
// x = ['胡子瑜', 10]  //✔
// x = [10,'hello']   //❌
var notsure = 4;
// notsure = 'this a number'
console.log(notsure);
var list11 = [1, true, '111'];
console.log(list11);
list11[1] = 100;
function sun(a, b) {
    return a + b;
}
console.log(sun(11, 22));
// for (var iw = 0; iw < 10; iw++) {
//     (function(iw){
//         setTimeout(function(){
//             console.log(iw);
//         },100*iw)
//     })(iw)
// }
function f(input) {
    var a = 100;
    var b1 = 200;
    if (input) {
        var b1_1 = a + 1;
        return b1_1;
    }
    return b1;
}
